#define _CRT_SECURE_NO_WARNINGS 1

//#include <iostream>
//#include <string>
//using namespace std;
//
//int main()
//{
//    string s1;
//    string s2;
//    while (cin >> s1)
//    {
//        for (int i = s1.size() - 1; i >= 0; --i)
//        {
//            s2.push_back(s1[i]);
//        }
//        for (int i = 0; i < s2.size(); ++i)
//        {
//            cout << s2[i];
//        }
//    }
//    return 0;
//}

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int GetLongestSub(string s1, string s2)
{
    if (s1.size() > s2.size())
        swap(s1, s2);
    int n1 = s1.size();
    int n2 = s2.size();
    vector<vector<int>> vv(n1, vector<int>(n2, 0));
    int max = 0;
    for (int i = 0; i < n1; ++i)
    {
        for (int j = 0; j < n2; ++j)
        {
            if (s1[i] == s2[j])
            {
                if (i >= 1 && j >= 1)
                    vv[i][j] = vv[i - 1][j - 1] + 1;
                else
                    vv[i][j] = 1;
            }
            if (vv[i][j] > max)
            {
                max = vv[i][j];
            }
        }
    }
    return max;
}

int main()
{
    string str1;
    string str2;
    while (cin >> str1 >> str2)
    {
        int max_len = GetLongestSub(str1, str2);
        cout << max_len << endl;
    }
    return 0;
}